<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <button @click="increase">increase</button>
  <button @click="stop">stop</button>
  <p>{{count}}</p>
</div>
<script type="module">
import {createApp, ref, watchEffect} from './node_modules/vue/dist/vue.esm-browser.js'

createApp({
  setup() {
    const count = ref(0)
    const stop = watchEffect(() => { // watchEffect在初始化的时候执行一次，数据变化时再次执行
      console.log(count.value)
    })

    return {
      count,
      stop,
      increase: () => count.value++
    }
  }
}).mount('#app')
</script>
</body>
</html>
